
<%@ page import="rentadomus.House" %>
<%@ page import="rentadomus.Dwelling" %>  
<%@ page import="rentadomus.Place" %>  
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'house.label', default: 'House')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-house" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div id="list-house" class="content scaffold-list" role="main">
			<h1><g:message code="default.list.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<table>
				<thead>
					<tr>
					
						<g:sortableColumn property="tittlePlace" title="Title Of place" />
                                                
                                                <g:sortableColumn property="Adress" title="Adress" />
                                                
                                                <g:sortableColumn property="neighborhood" title="Neighborhood" />
                                                
                                                <g:sortableColumn property="area" title="Área" />
                                                
						<g:sortableColumn property="floors" title="${message(code: 'house.floors.label', default: 'Floors')}" />
                                                
                                                <g:sortableColumn property="managementPrice" title="Rent Price" />
					
					</tr>
				</thead>
				<tbody>
				<g:each in="${Place.findAll(sort: 'date', order:'desc')}" status="i" var="it">
                                    <g:each in="${Dwelling.findAll()}" status="j" var="ot">          
                                        <g:if test="${ot.idPlace.id == it.id}">
                                          <g:each in="${houseInstanceList}" status="k" var="houseInstance">          
                                            <g:if test="${ot.id == houseInstance.idDwelling.id}">  
                                                <tr class="${(k % 2) == 0 ? 'even' : 'odd'}">

                                                        <td>${fieldValue(bean: it, field: "titlePlace")}</td>
                                                              
                                                              <td>${fieldValue(bean: it, field: "address")}</td>
                                                              
                                                              <td>${fieldValue(bean: it, field: "neighborhood")}</td>
                                                              
                                                              <td>${fieldValue(bean: it, field: "area")} mts^2</td>
                                                        
                                                              <td>${fieldValue(bean: houseInstance, field: "floors")}</td>

                                                              <td>${fieldValue(bean: it, field: "rentPrice")}</td>

                                                </tr>
                                            </g:if>
                                          </g:each>
                                        </g:if>  
                                      </g:each>
                                  </g:each>
				</tbody>
			</table>
			<div class="pagination">
				<g:paginate total="${houseInstanceTotal}" />
			</div>
		</div>
                <br>
                <a href="/RentADomus/listPlace/main/" >
                  <fieldset class="buttons">
                          <g:submitButton name="Back" class="back" value="Back" />
                  </fieldset>

                </a>
	</body>
</html>
